package reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Test {
    public static void main(String[] args) throws  Exception {
        Class cls = Class.forName("reflect.Person");
        Object obj = cls.newInstance();
        Method[] methods =  cls.getDeclaredMethods();
        for(Method m : methods){
            if(m.getParameterCount()==0){
                System.out.println("有参数的构造方法"+m.getName()+"()");
                m.invoke(obj);
            }
        }
    }
}
